import { Ref, ref, WatchStopHandle } from "vue";

export class simulationMenuData {
    public Title: string;
    public Types: number;
    public State: number;
    constructor(title: string = '', types: number = 0, state: number = 0) {
        this.Title = title
        this.Types = types
        this.State = state
    }
}
export class EchoData {
    public id: number;
    public Name: string;
    constructor(name: string = '', id: number = 0) {
        this.id = id
        this.Name = name
    }
}

/**
 * 实训菜单
 */
export default class simulationData {
    private static instance: simulationData = new simulationData();
    /**
     * 实训菜单
     */
    public static get Default(): simulationData {
        return this.instance;
    }

    constructor() {
        window.addEventListener('unload', this.Dispose.bind(this));
    }

    Dispose() {
        window.removeEventListener('unload', this.Dispose);

        for (const watchStopHandle of this.watchStopHandles) {
            watchStopHandle();
        }
        // this.watchStopHandles.clear();
    }
    public trainingDatalist: Ref<Array<any>> = ref([])

    public TriggerValue: Ref<boolean> = ref(false)
    //鼠标事件状态
    public MouseValue: Ref<boolean> = ref(false)

    private watchStopHandles: Array<WatchStopHandle> = [];

    // 回显状态
    //存储选项数据
    public historyList: Map<number, Array<any>> = new Map();
    //存储下标
    public subscript: Ref<number> = ref(-1);


    public async Awake(): Promise<void> {
    }

    public async Destroy(): Promise<void> {
    }
}